<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/9/19
  Time: 9:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="<c:url value='/js/jquery-1.8.2.js'/>"></script>
</head>
<body>
    <center>
        <form action="<c:url value='/airServlet'/>" method="post">
            <input type="hidden" name="method" value="list"/>
            <input type="hidden" name="yema"/>
            <input type="hidden" name="id" value="${id}"/>
        </form>
        <table>
            <tr align="center">
                <td colspan="100">
                    <h1>空气质量监测信息库</h1>
                </td>
            </tr>
            <tr align="center">
                <td colspan="100" align="center">
                    按区域查询<select name="districtid">
                                <option value="-1">不限</option>
                                <c:forEach var="d" items="${dlist}">
                                    <option value="${d.id}" ${id==d.id?'selected':''}>${d.name}</option>
                                </c:forEach>
                             </select>
                    <input type="button" value="查找" onclick="look()"/><a href="">添加空气质量信息</a>
                </td>
            </tr>
            <tr align="center" bgcolor="aqua">
                <th>
                    序号
                </th>
                <th>区域
                </th>
                <th>监测时间
                </th>
                <th>
                    PM10数据
                </th>
                <th>PM2.5数据</th>
                <th>监测站</th>
            </tr>
            <c:forEach varStatus="aa" items="${list}" var="a">
                <tr bgcolor="${aa.index%2==0?'':'#adff2f'}" align="center">
                    <td>${a.id}</td>
                    <td><a href="<c:url value='/airServlet?method=toupdate&id=${a.id}'/>">${a.name}</a></td>
                    <td>${a.monitortime}</td>
                    <td>${a.pm10}</td>
                    <td>${a.pm25}</td>
                    <td>${a.monitoringstation}</td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="100">
                    <a href="#" onclick="paging(1)">首  页</a>&nbsp;|&nbsp;
                    <a href="#" onclick="paging(${page.previousPage})">&lt;&lt;上一页</a>&nbsp;|&nbsp;
                    <a href="#" onclick="paging(${page.nextPage})">下一页&gt;&gt;</a>&nbsp;|&nbsp;
                    <a href="#" onclick="paging(${page.pageCount})">尾 页</a>&nbsp;
                    第${page.currentPage}页/共${page.pageCount}页&nbsp;(${page.count}&nbsp;条)
                </td>
            </tr>
        </table>
    </center>
<script>
    function paging(yema) {
        $("[name='yema']").val(yema);
        var districtid = $("[name='districtid']").val();
        $("[name='id']").val(districtid);
        document.forms[0].submit();
    }
    function look() {
        var districtid = $("[name='districtid']").val();
        $("[name='id']").val(districtid);
        document.forms[0].submit();
    }
</script>
</body>
</html>
